<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Collection"%>
<%@page import="orm.Users"%>
<%@page import="hibernatelogic.HibUsers"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%
	HttpSession sess = request.getSession();
	if (sess.isNew()) {
		response.sendRedirect("/my-pet-project-0/Login.jsp");
	} else {
%>
<%
	if (((String) sess.getAttribute("UserRole")).equals("3")) {
%>
<%
	HibUsers hibUsers = new HibUsers();
			Users user = new Users();
			Collection col = null;
			Iterator it = null;
			col = hibUsers.getAllUsers();
			ArrayList tmpCol = (ArrayList) col;
			it = tmpCol.iterator();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Delete User</title>
</head>
<body>
	<a href="/my-pet-project-0/Login.jsp">Logout</a>
	<a href="/my-pet-project-0/AdminStartPage.jsp">Back</a>
	<br>
	<br>
	<center>
		Which user do you want to delete? <br> <br>
		
		<form action="delete-user-servlet" method="post">
			<select name="duser">
				<%
					while (it.hasNext()) {
				%>
				<%
					user = (Users) it.next();
				%>
				<option value=<%=user.getUser_id()%>><%=user.getName()%>
					<%
						}
					%>
				
			</select> <input type="submit" value="Delete User">
		</form>
		
	</center>
</body>
</html>
<%
	} else {
%>
<%
	response.sendError(response.SC_FORBIDDEN,
					"Not permitted to enter as ADMINISTRATOR");
%>
<%
	}
	}
%>